using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NetManager : MonoBehaviour
{
    //NetClient m_NetClient;
    //Queue<KeyValuePair<int, string>> m_MessageQueue = new Queue<KeyValuePair<int, string>>();
    //XLua.LuaFunction ReceiveMessage;

    ////为什么不卸载awake或者start中呢？：因为需要在lua中获取这个方法，需要在lua完成后手动调用Init方法。如果用start或者awake，lua还没初始化好
    //public void Init()
    //{
    //    m_NetClient = new NetClient();
    //    ReceiveMessage = Manager.Lua.LuaEnv.Global.Get<XLua.LuaFunction>("ReceiveMessage");
    //}

    ////发送消息
    //public void SendMessage(int messageID, string message)
    //{
    //    m_NetClient.SendMessage(messageID, message);
    //}

    ////链接到服务器
    //public void ConnectServe(string ip, int port)
    //{
    //    m_NetClient.OnConnectServer(ip, port);
    //}

    ////网络连接
    //public void OnNetConnect()
    //{
    //    Debug.Log("连接成功");
    //}

    ////被服务器断开连接
    //public void OnDisConnect()
    //{
    //    Debug.Log("断开连接");
    //}

    ////接收到数据
    //public void Receive(int messageID, string message)
    //{
    //    m_MessageQueue.Enqueue(new KeyValuePair<int, string>(messageID, message));
    //}

    //private void Update()
    //{
    //    if (m_MessageQueue.Count > 0)
    //    {
    //        KeyValuePair<int, string> message = m_MessageQueue.Dequeue();
    //        ReceiveMessage?.Call(message.Key, message.Value);
    //    }
    //}
}
